
   function search(){
	   
	   var dataSearch = function(){
			var obj = {};
			  obj.find = function(showData){
				 var areaName = document.getElementById("areaIn").value;
	             var xhr = new XMLHttpRequest();
	             xhr.open("GET","http://localhost:8089/ajaxtest/search?areaName="+areaName);
	             xhr.onreadystatechange = function(){
	             	if(xhr.status==200&&xhr.readyState==4){
	                       var data = JSON.parse(xhr.responseText);
	                       showData(data);
	                      //console.log(data[0]);
	             	}
	             };
	             xhr.send(null);	
			} 
			    obj.showData = function(data){
				  var ul = document.getElementById("ul");
				  ul.innerHTML="";
				  
				  data.forEach(item=>{
					var li = document.createElement("li");
						li.innerHTML=item;
						ul.appendChild(li); 
				  });
			  }
			  
			  return obj;
	   }
	   
	 
	   
	   var searcher = dataSearch();
	   var show = searcher.showData;
	   searcher.find(show);  
 }
